@extends('Layout/adminBase')
@section('css')


@endsection
@section('body')
<div class='container'>
  <div class="head-list">
    <form class="form-inline search" role="form" action="{{url('/admin/User/index')}}">
        <div class="form-group">
          <input type="text" class="form-control" id="name" placeholder="用户名搜索" name='name'>
        </div>
        <div class="form-group">  
            <div class='input-group date datetimepicker1' >  
                <input type='text' class="form-control"  name='startDate' data-date-format="yyyy-mm-dd" readonly=""  placeholder="开始日期" />  
                <span class="input-group-addon">  
                    <span class="glyphicon glyphicon-calendar"></span>  
                </span>  
            </div>  
        </div>
        至
        <div class="form-group">  
            <div class='input-group date datetimepicker1'>  
                <input type='text' class="form-control" name='endDate'  data-date-format="yyyy-mm-dd" readonly=""  placeholder="结束日期" />  
                <span class="input-group-addon">  
                    <span class="glyphicon glyphicon-calendar"></span>  
                </span>  
            </div>  
        </div>    
        <button type="submit" class="btn btn-success"><i class='glyphicon glyphicon-search'></i>搜索</button>
    </form>
    <div class='btn-excel' >
      <a href="{{url('/admin/User/excel')}}" class='btn btn-success'><i class="glyphicon glyphicon-download-alt"></i>导出Excel</a>
    </div>
  </div>
<div id='Common'>
 @include('Common/tip')

 </div>


<script>
  //一次性定时器 让错误提示2秒后消失
 setTimeout(function () {
      

      var common = document.getElementById('Common');

      common.style.display = 'none';

    }, 2000);
</script>

<table class="table table-condensed">
  <caption>用户管理</caption>
  <thead>
    <tr>
      <th>序号</th>
      <th>用户级别</th>
      <th>用户名</th>
      
      <th>性别</th>
      <th>电话</th>
      <th>邮箱</th>
      <th>状态</th>
      <th>注册日期</th>
      
     
      
      <th class="oprit">操作</th>
    </tr>
  </thead>
  <tbody>

@foreach($user as $v)

    <tr align="center">
          <td>{{$v->id}}</td>
          <td>{{$user_level[$v->user_level]}}</td>
          <td>{{$v->name}}</td>
          <td>{{$sex[$v->sex]}}</td>
          <td>{{$v->phone}}</td>
          <td>{{$v->email}}</td>
          <td>{{$state[$v->state]}}</td>
          <td>{{$v->addtime}}</td>
          <td>
            <a  class="btn btn-default btn-xs btnError  " href="{{url('/admin/User/delete',$v->id)}}" >删除</a>
           <a  class="btn btn-default btn-xs btnPrimary" href="{{url('/admin/User/show', $v->id)}}">编辑</a>
           <a  class="btn btn-default btn-xs btnInfo" href="{{url('/admin/User/detail', $v->id)}}">查看详情</a>
           <a  class="btn btn-default btn-xs btnSucess" href="{{url('admin/integral/show', $v->id)}}">积分明细</a>
          </td>
        
 
      </tr>
     
    @endforeach
    
    </tr>

  </tbody>
  
</table>
<div style="float: right;">
     {{$user->appends(['startDate'=>$startDate,'endDate'=>$endDate])->links()}}    
</div>


</div>
@endsection
@section('footer-js')
<script type="text/javascript">
    $(function () {  
    $('.datetimepicker1').datetimepicker({ 
        language:  'zh-CN' ,
        format:'yyyy-mm-dd',
        setDate: new Date(),
        weekStart: 1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0  
    });  
});  
</script>

@endsection